package com.ruoyi.job.config;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;

@Component
public class EmailUtil {
    @Autowired
    JavaMailSender javaMailSender;


    /**
     * 发送验证码
     * @param email
     */
    public  void sendEmail(String email,String subject,String context){
        SimpleMailMessage message = new SimpleMailMessage();
        message.setSubject(subject);
        message.setFrom("2262665149@qq.com");
        message.setTo(email);
        message.setText(context);//验证码
        javaMailSender.send(message);//邮箱发送一份

    }
}

